<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = prompt('输入等腰三角形的高：')*1;//这样获取的是字符串,需要转换为数字
        for (var i = 1; i <= num; i++) {
            for (var j = 1; j <= num * 2 - 1; j++) {
                if (j <= num - i) {
                    document.write('&emsp;');
                } else if (j >= num + i) {
                    document.write('&emsp;');
                } else {
                    document.write('七');
                }
            }
            document.write('<br>');
        }
    </script>
</body>

</html>